package xin.yangshuai.forest01.config;

import com.dtflys.forest.converter.json.ForestFastjson2Converter;
import com.dtflys.forest.converter.json.ForestJsonConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * ForestConfig
 *
 * @author shuai
 * @date 2024/7/23
 */
@Configuration
public class ForestConfig {

    @Bean
    public ForestJsonConverter forestFastjson2Converter() {
        ForestFastjson2Converter converter = new ForestFastjson2Converter();
        // 设置日期格式
        converter.setDateFormat("yyyy-MM-dd HH:mm:ss");
//        // 设置序列化特性
//        converter.addWriterFeature(JSONWriter.Feature.IgnoreNoneSerializable);
//        // 设置反序列化特性
//        converter.addReadFeature(JSONReader.Feature.ErrorOnNoneSerializable);
        return converter;
    }


}
